/**
 Copyright will be fixed soon.
 Author: Hiroshi Ota.
 $Date: $
 $Revision: $
*/

#ifndef _PW_KEY_H_
#define _PW_KEY_H_

#ifndef _BRICKOS_
#include "ISimulatorControl.h"
#endif

class Key
{
public:
	enum KEY {
		KEY_ONOF = 0x01,
		KEY_RUN  = 0x02,
		KEY_VIEW = 0x04,
		KEY_PRGM = 0x08,
		KEY_ANY  = 0x0f
	};

	static Key* create();
#ifndef _BRICKOS_
	static Key* create(ISimulatorControl* sc);

#endif

	typedef unsigned long (*wakeup)(void*);
	unsigned long taskStart(wakeup);

	// block until any key pressed and return pressed keys
	enum KEY pressed(enum KEY keys);
	// block until any key released and return released keys
	enum KEY released(enum KEY keys);

protected:
#ifndef _BRICKOS_
	Key(ISimulatorControl* sc);
	ISimulatorControl* simCon;
#endif

	Key(void);
	virtual ~Key(void);
	
	static Key* instance;
};

#endif // _PW_KEY_H_
